<?php
include '../com/mss/action/MonasteryAction.php';

if (isset($_POST["submit"]) ) {
	if (isset($_FILES["file"])) {
		if ($_FILES["file"]["error"] > 0) {
			echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
		} else {
			/*echo "Upload: " . $_FILES["file"]["name"] . "<br />";
			echo "Type: " . $_FILES["file"]["type"] . "<br />";
			echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
			echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";*/

			//get the csv file
			$file = $_FILES["file"]["tmp_name"];
			$monastery_action = new MonasteryAction();
			$monastery_action->save($file);
		}
	} else {
		echo "No file selected <br />";
	}
}

?>
<div id="content" class="inputForm">
<h4>Add Monasteries</h4>
<fieldset>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
	<label>First Name : </label>
		<input type="file" name="file" />
		<input type="submit" name="submit" value="Submit" class="formbutton" align="right" />
		<br><br>
</form>
</fieldset>
</div>